package com.thirteenClassicsServer.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import com.thirteenClassics.annotation.AutoFill;
import com.thirteenClassics.entity.Explain;
import com.thirteenClassics.enumeration.OperationType;

@Mapper
public interface ExplainMapper {
    List<Explain> selectBySentenceId(Long sentenceId, Long banben, String bookName);

    @Delete("delete from `explain` where sentence_id =#{sentenceId} and banben=#{banben} and book_name=#{bookName}")
    void deleteBySentenceId(Long sentenceId, Long banben, String bookName);

    @Insert("insert into `explain` (sentence_id, word, word_explain, word_m1, word_m2, banben, book_name, "
            + "create_time, create_user, update_user, update_time) values "
            + "(#{sentenceId}, #{word}, #{wordExplain}, #{wordM1}, #{wordM2}, #{banben}, #{bookName}, #{createTime}, "
            + "#{createUser}, #{updateUser}, #{updateTime})")
    @AutoFill(OperationType.INSERT)
    void insert(Explain explain);
}
